package ru.btabank.dom.xpath.namespace;

import java.util.HashMap;

public class NamespaceMap {
    private HashMap declarations;

    public NamespaceMap() {
        declarations = new HashMap();
    }

    public String resolve(String prefix) throws UnresolvableException {
        if (this.contains(prefix))
            return (String)declarations.get(prefix);
        else
            throw new UnresolvableException(prefix);
    }

    public void add(String prefix, String URI) {
        declarations.put(prefix, URI);
    }

    public boolean contains(String prefix) {
        return declarations.containsKey(prefix);
    }
}
